package com.example.scheduledtask.schedule.quartz;

import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @ClassName QuartzTask
 * @Description
 * @Author huyingliang
 * @Date 2024-02-04 15:10
 */
public class QuartzJob extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        /*获取执行定时任务需要的参数*/
        JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        jobDataMap.forEach((k, v) -> {
            System.out.println("key:" + k + " value:" + v);
        });
    }
}
